package com.qf.web;

import cn.com.webxml.MobileCodeWSSoap;
import com.qf.util.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 2019/11/29
 * 键盘敲烂，月薪过万
 * 登高必自卑，行远必自迩。
 * 不忘初心：像初学者一样拥有一颗谦虚、开放的心态。
 * 李学峰
 */
@Controller
public class PhoneController {
    @Autowired
    private MobileCodeWSSoap soap;

    @RequestMapping("/getaddress")
    @ResponseBody
    public Message ss1(String phone){
        Message message = new Message();
        String info = soap.getMobileCodeInfo(phone, "");
        System.out.println((info.indexOf("：")==-1));
        if (info.indexOf("：")==-1){
            message.setAddress(info);
        }else {
            String[] strings = info.split("：");
            message.setAddress(strings[1]);
        }
        return message;
    }
}
